Altitude Hold Setup Using SU04 via I2C with Crossflight, Mini Pix, and PIXHAWK

(Open-Source Firmware v4.3 and Above)


Configuration Instructions (Altitude Hold Function)

  1. Connect the SU04 to the flight controller.
  2.  In the full parameter list, search for RNGFND1_. As shown in the figure below, set RNGFND1_TYPE it to 2, then click Write Parameters.
  3.  After power cycling the flight controller, it will successfully recognize the SU04.
  4. (Note: Starting from firmware version 4.3, the flight controller has a longer boot time. When using an older ultrasonic sensor, you need to power the flight controller with a battery first, and then immediately plug in the ultrasonic sensor to ensure a successful connection.)
  5. Set the following parameters:
  6. RNGFND1_MAX_CM to 450
  7. RNGFND1_MIN_CM to 43 (unit: cm)
  8. RNGFND1_ORIENT to 25

Parameter Descriptions

  1. RNGFND1_MAX_CM: The maximum distance that the flight controller can recognize from the module in altitude hold mode.
  2. RNGFND1_MIN_CM: The minimum distance that the flight controller can realize from the module in altitude hold mode.
  3. When the distance reported by the module is outside the range of 43–450 cm, the flight controller will not use the module data and will instead rely on the barometer for altitude hold.


Viewing Ultrasonic Sensor Data

1. Viewing ultrasonic data in the Quick interface

Connect the flight controller to the Mission Planner. In the Quick interface, double-click the tab to bring up a large list. Select sonarrange, and the ultrasonic height data will be displayed in that position.




2. Viewing ultrasonic data in the Debug interface

Enable the debug option in the ground station. Double-click the pop-up dynamic table, select sonarrange from the list, and the real-time waveform of the ultrasonic data will be displayed, as shown in the figure below.